<template>
  <div class="table-container">
    <div class="table-title">居民农业影响</div>
    <div class="formula-detail">
      <el-collapse class="formula-collapse" v-model="activeNames" accordion @change="handleChange">
        <el-collapse-item title="公式详情" name="1">
          <div class="formula">实际电费 = 实际电量 * 单价</div>
        </el-collapse-item>
      </el-collapse>
    </div>
    <el-table :data="tableData" border style="width: 100%" show-summary>
      <el-table-column prop="project" label="项目" width="150"></el-table-column>
      <el-table-column prop="category" label="分类" width="150"></el-table-column>
      <el-table-column prop="electric" label="电量" width="150">
        <template #default="scope">
          <el-input size="small" v-model="scope.row.electric"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="cost" label="现购电成本" width="150">
        <template #default="scope">
          <el-input size="small" v-model="scope.row.cost"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="diff_price" label="价差" width="150"></el-table-column>
      <el-table-column prop="diff_cost" label="费差" width="150"></el-table-column>
      <el-table-column prop="remark" label="备注"></el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: 'Resident',
  inheritAttrs: false,
});

const tableData = reactive([
  {
    project: '实际数',
    category: '居民生活用电',
    electric: '',
    cost: '',
    diff_price: '',
    diff_cost: '',
    remark: '',
  },
  {
    project: '实际数',
    category: '农业生产用电',
    electric: '',
    cost: '',
    diff_price: '',
    diff_cost: '',
    remark: '',
  },
  {
    project: '实际数',
    category: '农业排灌用电',
    electric: '',
    cost: '',
    diff_price: '',
    diff_cost: '',
    remark: '',
  },
  {
    project: '实际数',
    category: '线损电量',
    electric: '',
    cost: '',
    diff_price: '',
    diff_cost: '',
    remark: '',
  },
]);

const activeNames = ref('1');
const handleChange = (val: any) => {};
</script>

<style lang="scss" scoped>
.formula-detail {
  display: flex;
  justify-content: flex-end;
}
.formula-collapse {
  max-width: 100%;
  border-radius: 10px;
  background-color: #ffffff;
  padding-left: 10px;

  :deep(.el-collapse-item__header) {
    color: #4080ff;
    background-color: transparent;
  }
}
.formula {
  padding: 5px;
}
</style>